﻿@model NCP.Recruiting.WebApp.Models.BookmarkListViewModel
@using NCP.Recruiting.WebApp.Extensions;
@{
    ViewBag.Title = "暂存简历库";
}

<script type="text/javascript">
    $(function () {
        $('#btnPreviewSelected').bind('click', function () {
            var selectedCount = $('.itemChecked:checked').length;
            if (selectedCount == 0) {
                alert("请先选择要进行操作的简历！");
                return false;
            }
            getCheckedIdList();
        });

        $('#btnDeleteSelected').bind('click', function () {
            var selectedCount = $('.itemChecked:checked').length;
            if (selectedCount == 0) {
                alert("请先选择要进行操作的简历！");
                return false;
            }
            if (!confirm('确定要删除所选简历吗？')) {
                return false;
            }
            getCheckedIdList();
        });

        $('#btnTrigDeleteSelected').bind('click', function () {
            $('#btnDeleteSelected').click();
        });

        $('#btnTrigDeleteSelected').button();

        $('.chkAll').bind('click', function () {
            $('.itemChecked').prop('checked', $(this).prop('checked'));
        });
    });

    function deleteBookmark(id) {
        if (!confirm('确定要删除简历吗？')) {
            return false;
        }
        $('#hidId').val(id);
        $('#btnDelete').click();
    }

    function getCheckedIdList() {
        var idList = "";
        $(".itemChecked:checked").each(function () {
            idList += $(this).val() + ",";
        });
        $('#hidIdList').val(idList);
    }
</script>

<div id="wrap">
    <div class="wrapContents">

        <h1>
            暂存简历库
        </h1>
        <div class="search">
            <div class="search_left">
                <div class="caozuo">
                    <a href="#" onclick="$('#btnPreviewSelected').click()">查看所选</a>
                </div>
                <div class="cl">
                </div>
            </div>
            <div class="search_right">
                @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
            </div>
            <div class="cr">
            </div>
        </div>
        <table cellpadding="0" cellspacing="0" width="100%" id="tblJobList">
            <thead>
                <tr>
                    <th>
                        <input class="chkAll" type="checkbox" />
                    </th>
                    <th>
                        &nbsp;
                    </th>
                    <th>
                        姓名
                    </th>
                    <th>
                        年龄
                    </th>
                    <th>
                        工作经验
                    </th>
                    <th>
                        专业
                    </th>
                    <th>
                        期望从事行业
                    </th>
                    <th>
                        最近工作职位
                    </th>
                    <th>
                        最终学历
                    </th>
                    <th>
                        简历刷新时间
                    </th>
                    <th>
                        联系电话
                    </th>
                </tr>
            </thead>
            <tbody id="tbodyJobList">
                @foreach (var item in Model.BookmarkList)
                {
                    <tr>
                        <td>
                            <input type="checkbox" class="itemChecked" value="@item.Id">
                        </td>
                        <th>
                            &nbsp;
                        </th>
                        <td style="text-align:left">
                            @Html.ActionLink(item.Name, "Priview", "Resume", new { id = item.ResumeId }, null)
                        </td>
                        <td>
                            @item.Age
                        </td>
                        <td>
                            @item.YearsOfExperience
                        </td>
                        <td>
                            @item.Major
                        </td>
                        <td>
                            @item.DesiredIndustry
                        </td>
                        <td>
                            @item.CurrentJob
                        </td>
                        <td>
                            @item.EducationLevel
                        </td>
                        <td>
                            @item.LastUpdate
                        </td>
                        <td>
                            @Html.ActionLink("浏览", "Priview", "Resume", new { id = item.ResumeId }, null)|<a href="#" onclick="deleteBookmark('@item.Id')">删除</a>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
        <div class="pagelists">
            <div class="pagelists_btns">
                <div class="allCheck">
                    <input class="chkAll" type="checkbox" /><span>全选</span>
                </div>
                &nbsp;
                <input id="btnTrigDeleteSelected" type="button" value="删除所选" />
            </div>
            <div class="search_right">
                @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
            </div>
            <div class="cr">
            </div>
        </div>
    </div>
</div>
@using (Html.BeginForm())
{
    <input type="hidden" id="hidIdList" name="idList" />
    <input type="hidden" id="hidId" name="id" />
    <input id="btnPreviewSelected" name="PreviewSelected" type="submit" style="display:none" />
    <input id="btnDeleteSelected" name="DeleteSelected" type="submit" value="删除所选" style="display:none" />
    <input id="btnDelete" name="Delete" type="submit" value="删除" style="display:none" />
}